`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    18:52:45 05/28/2013 
// Design Name: 
// Module Name:    OnBoardLedController 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Revision 0.02 - Andrew - parameterized the number of LEDs. maintaining backwards compatibility
//				by using a default of 8.
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module OnBoardLedController #(parameter numLeds = 8)(
    input  clk,
	 input reset,
	 input enable,
	 input [3:0] address,
    input [31:0] dataIn,
	 output [31:0] dataOut,
	 input write,
	 output done,
	 output interrupt,
	 output [numLeds-1:0] ledPins
    );
	 parameter DRP_ID = 32'hA001001A;
	 
	 reg [numLeds-1:0] ledsReg;
	 
	 assign ledPins = ledsReg;
	 
	 always @( posedge clk , posedge reset )  begin
		if(reset) ledsReg <= 0;
		else if(write & enable) ledsReg <= dataIn[numLeds-1:0];
		else ledsReg <= ledsReg;
	end
	
	assign dataOut = (address == 4'd15) ? DRP_ID : ledsReg;
	//assign done = write ? (ledPins[numLeds-1:0] == dataIn[numLeds-1:0]) : 1'b1;
	assign done = 1;
	assign interrupt = 1'b0;
endmodule
